const signin = (ctx, next) => {
    var name = ctx.request.body.name || "";
    var password = ctx.request.body.password || "";
    console.log(`singin with name: ${name}, password: ${password}`);
    if (name === 'koa' && password === '123456') {
        ctx.response.body = `<h1>welcome, ${name}!</h1>`;
    } else {
        ctx.response.body = `<h1>login failed</h1>
            <p><a href="/">TRY again</a></p>`;
    }
}

module.exports = {
    "POST /signin": signin
}